home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
VISUALBA
/
DBFM2.ZIP
/
MAILLIST.BAS
< prev
next >
Wrap
BASIC Source File
|
1994-02-06
|
32KB
|
939 lines
DECLARE SUB QuitFunctions (xk%)
DECLARE SUB BrowseRecords (krs%, ky$, rec$, status%)
DECLARE SUB RecordFunctions (xk%)
DECLARE SUB PrintFunctions (xk%)
DECLARE SUB MiscFunctions (xk%)
DECLARE SUB FileFunctions (xk%)
DECLARE SUB Display (rec$)
DECLARE SUB Help ()
DECLARE SUB FindRecord (krs%, ky$, rec$, status%)
DECLARE SUB AddRecord (krs%, ky$, rec$, status%)
DECLARE SUB DeleteRecord (krs%, ky$, rec$, status%)
DECLARE SUB ChangeRecord (krs%, ky$, rec$, status%)
DECLARE SUB PrintML1 (rec$)
DECLARE SUB PrintML0 ()
DECLARE SUB PrintML9 ()
DECLARE SUB PrintML2 (rec$)
DECLARE SUB ReIndexFile ()
DECLARE SUB CloseFiles ()
DECLARE SUB OpenFiles ()
' IMDEMO.BAS by Marty Francom
' This program is demonstrates the use of Index Manager. Each index record
' consists of a key and a pointer to the data file. Such that the key file
' record (KyF$) is defined:
' ky$ = KeyString$ rn& = Pointer to data record krs% = KeyRecordSet
' Rec$= DataRecord Rfn%= data record file number Rfl%= Data record Length
'
' For the purpose of this demo I open only 1 index and data file however
' it is a simple matter to open additional index and data files.
DECLARE FUNCTION ColorAttribute% (row%, col%)
DECLARE FUNCTION CurToDollar$ (Cur@, L%)
DECLARE FUNCTION DayOfWeek$ ()
DECLARE FUNCTION FILEXISTS% (FILNAM$)
DECLARE FUNCTION GetBackGround% (row%, col%)
DECLARE FUNCTION GetForeGround% (row%, col%)
DECLARE FUNCTION GetVideoSegment& ()
DECLARE FUNCTION IntgrToDollar$ (Intgr&, L%)
DECLARE FUNCTION KeyIn% ()
DECLARE FUNCTION NumDays& (dt1$, dt2$)
DECLARE FUNCTION NumToString$ (n#, dp%, Ln%)
DECLARE SUB Cdate (dt$)
DECLARE SUB DateEdit (row%, col%, colr%, vk$, dt$, xk%)
DECLARE SUB FastPrint (row%, col%, st$, colr%)
DECLARE SUB EditField (row%, col%, colr%, vk$, st$, xk%)
DECLARE SUB Julian (dt$)
DECLARE SUB PhoneEdit (row%, col%, colr%, vk$, pn$, xk%)
DECLARE SUB PopWindow (TopRow%, LeftCol%, BottomRow%, RightCol%, colr%)
DECLARE SUB PutScreen (file$)
DECLARE SUB RestoreScrn (Scrn$)
DECLARE SUB SaveScrn (Scrn$)
DECLARE SUB Wipe (top%, bottom%, lft%, rght%, colr%)
DECLARE SUB AddKeyRec (krs%, ky$, rec$, rn&, status%)
DECLARE SUB CreateOpenClose (krs%)
DECLARE SUB DeleteKeyRec (krs%, ky$, rec$, status%)
DECLARE SUB GetEqual (krs%, ky$, rec$, rn&, status%)
DECLARE SUB GetNext (krs%, ky$, rec$, status%)
DECLARE SUB GetPrev (krs%, ky$, rec$, status%)
DECLARE SUB IndexError (rc%)
DECLARE SUB Info (krs%, xn%, kl%, Rfn%, Rfl%)
'
' Link in the Index Manager subprogram
DECLARE SUB im (ndx%, opcode$, ndxfn$, keylen%, ky$, datarn&, rc%)
$LINK "IMOB.OBJ" ' this must be in main program
$LINK "C:\PB3\UNIT\MYLIB.PBU" ' " " " " " "
' IMOB.OBJ is an assembly language B-Tree index manager for PowerBasic. As
'many as 10 index files can be opened, manipulated and maintained all at the
'same time. IMOB.OBJ is copyright of FRED LEPOW of CDP Consultants. Several
'versions of IMOB.OBJ are available. For further Information about Index
'Manager contact Fred Lepow at:
' CDP Consultants
' 1700 Circo Del Cielo Drive
' El Cajon, CA. 90202
' (619) 440-6482
' Required for Index Manager
DIM xn as shared integer
DIM kl as shared integer
DIM Rfn as shared integer
DIM Rfl as shared integer
DIM ky as shared string
'DIM Rec as shared string
DIM status as shared integer
' ******************* Beginning Main Program Code **********************
CLS
CALL PutScreen("MailList.Img")
'krs% = 3: CALL CreateOpenClose(krs%) 'contains pointers to deleted records
krs% = 2: CALL CreateOpenClose(krs%) 'Zip+Name Index
krs% = 1: CALL CreateOpenClose(krs%) 'Name Index + Data Record
xk% = -20
DO
LOCATE 1, 1, 0
IF xk% = 0 THEN CALL Display(rec$): xk% = KeyIn%
SELECT CASE xk%
CASE -59 'F1 key
CALL Help: xk% = 0
CASE 102, 70, -20, -18, -33, -25, -49, -48, -72, -80 'Ff
IF xk% = 102 OR xk% = 70 THEN CALL FileFunctions(xk%)
SELECT CASE (xk%)
CASE -18 'Alt E goto end of file
ky$ = STRING$(kl%, 254)
CALL GetEqual(krs%, ky$, rec$, rn&, status%): xk% = 0
CASE -20 'Alt T goto top of file
ky$ = STRING$(kl%, 32)
CALL GetEqual(krs%, ky$, rec$, rn&, status%): xk% = 0
CASE -33 'Alt F Find a record
CALL FindRecord(krs%, ky$, rec$, status%): xk% = 0
CASE -48 'Alt B browse records
CALL BrowseRecords(krs%, ky$, rec$, status%): xk% = 0
CASE -25, -72 'Alt P UpArrow get previous record
CALL GetPrev(krs%, ky$, rec$, status%): xk% = 0
CASE -49, -80 'Alt N DnArrow get next record
CALL GetNext(krs%, ky$, rec$, status%): xk% = 0
END SELECT
CASE 114, 82, -30, -32, -46
IF xk% = 114 OR xk% = 82 THEN CALL RecordFunctions(xk%)
SELECT CASE (xk%)
CASE -30 'Alt A Add a record
CALL AddRecord(krs%, ky$, rec$, status%): xk% = 0
CALL PutScreen("MailList.IMG")
CASE -32 'Alt D Delete current record
CALL DeleteRecord(krs%, ky$, rec$, status%): xk% = 0
CALL PutScreen("MailList.IMG")
CASE -46 'Alt C Change/Edit current record
CALL ChangeRecord(krs%, ky$, rec$, status%): xk% = 0
CALL PutScreen("MailList.IMG")
END SELECT
CASE 112, 80, -120, -121, -122, -123
IF xk% = 112 OR xk% = 80 THEN CALL PrintFunctions(xk%)
SELECT CASE (xk%)
CASE -120 ' Alt 1 Print current record to mailing label
CALL PrintML1(rec$): xk% = 0
CASE -129 ' Alt 0 Print mailing labels of all records
CALL PrintML0: xk% = 0
CASE -121 ' Alt 2 Print mailing labels by zip code
CALL PrintML9: xk% = 0
CASE -128 ' Alt 9 Print hard copy of current record
CALL PrintML2(rec$): xk% = 0
END SELECT
CASE 109, 77
CALL MiscFunctions(xk%)
SELECT CASE (xk%)
CASE -10 ' ReIndex Current Data File
CALL ReIndexFile: xk% = 0
CASE -11 ' Create New Data File & Index
CALL CloseFiles: xk% = 0
CASE -12 ' Load New Data File & Index
CALL OpenFiles: xk% = 0
END SELECT
CASE 113, 81, -16, 27
CALL QuitFunctions(xk%)
IF xk% = -16 THEN
CALL CloseFiles: EXIT DO
END IF
CASE ELSE
BEEP: xk% = 0
END SELECT
LOOP
CLS : END
SUB AddRecord (krs%, ky$, rec$, status%)
st$ = "MailList.Img": CALL PutScreen(st$)
new$ = SPACE$(683): cn% = 1
DO
SELECT CASE cn%
CASE 1
st$ = MID$(new$, 2, 28)
xk% = 11: CALL EditField(6, 20, 79, "", st$, xk%)
MID$(new$, 2, 16) = st$
CASE 2
st$ = MID$(new$, 31, 30)
xk% = 11: CALL EditField(8, 20, 79, "", st$, xk%)
MID$(new$, 31, 30) = st$
CASE 3
st$ = MID$(new$, 61, 30)
xk% = 11: CALL EditField(10, 20, 79, "", st$, xk%)
MID$(new$, 61, 30) = st$
CASE 4
st$ = MID$(new$, 91, 14)
xk% = 11: CALL EditField(12, 20, 79, "", st$, xk%)
MID$(new$, 91, 14) = st$
CASE 5
st$ = MID$(new$, 105, 2)
xk% = 11: CALL EditField(12, 45, 79, "", st$, xk%)
MID$(new$, 105, 2) = st$
CASE 6
st$ = MID$(new$, 107, 5)
xk% = 2: CALL EditField(12, 58, 79, "", st$, xk%)
MID$(new$, 107, 5) = st$
st$ = MID$(new$, 112, 4)
xk% = 2: CALL EditField(12, 64, 79, "", st$, xk%)
MID$(new$, 112, 4) = st$
CASE 7
st$ = MID$(new$, 116, 3)
xk% = 2: CALL EditField(14, 21, 79, "", st$, xk%)
MID$(new$, 116, 3) = st$
st$ = MID$(new$, 119, 3)
xk% = 2: CALL EditField(14, 26, 79, "", st$, xk%)
MID$(new$, 119, 3) = st$
st$ = MID$(new$, 122, 4)
xk% = 2: CALL EditField(14, 30, 79, "", st$, xk%)
MID$(new$, 122, 4) = st$
CASE 8
st$ = MID$(new$, 126, 62)
xk% = 1: CALL EditField(16, 10, 79, "", st$, xk%)
MID$(new$, 126, 62)